Skip to contentSkip to conversation

Change in openvpn[master]: socket_util: Clean up conversion warnings in add_in6_addr

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Aug 28, 2025 – Aug 31, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1756402061000.Id3b8719ee6b457ce2d85156b39e0cea771a97e74@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email

to review the following change.

Change subject: socket_util: Clean up conversion warnings in add_in6_addr
......................................................................

socket_util: Clean up conversion warnings in add_in6_addr

Change-Id Id3b8719ee6b457ce2d85156b39e0cea771a97e74

---
M src/openvpn/socket_util.c

1 file changed, 3 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/1161/1

src/openvpn/socket_util.c +3 -5
index 13f8c32..9b7312d 100644
@@ -241,14 +241,12 @@
 struct in6_addr
 add_in6_addr(struct in6_addr base, uint32_t add)
 {
-    int i;
-
-    for (i = 15; i >= 0 && add > 0; i--)
+    for (int i = 15; i >= 0 && add > 0; i--)
     {
-        register int carry;
+        register uint32_t carry;
         register uint32_t h;
 
-        h = (unsigned char)base.s6_addr[i];
+        h = base.s6_addr[i];
         base.s6_addr[i] = (h + add) & UINT8_MAX;
 
         /* using explicit carry for the 8-bit additions will catch

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74
Gerrit-Change-Number: 1161
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email )

Change subject: socket_util: Clean up conversion warnings in add_in6_addr
......................................................................

Patch Set 4: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74
Gerrit-Change-Number: 1161
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 31 Aug 2025 15:12:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH v4 1/1 socket_util: Clean up conversion warnings in add_in6_addr

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Change-Id Id3b8719ee6b457ce2d85156b39e0cea771a97e74

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1161
This mail reflects revision 4 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socket_util.c +3 -5
index 13f8c32..9b7312d 100644
@@ -241,14 +241,12 @@
 struct in6_addr
 add_in6_addr(struct in6_addr base, uint32_t add)
 {
-    int i;
-
-    for (i = 15; i >= 0 && add > 0; i--)
+    for (int i = 15; i >= 0 && add > 0; i--)
     {
-        register int carry;
+        register uint32_t carry;
         register uint32_t h;
 
-        h = (unsigned char)base.s6_addr[i];
+        h = base.s6_addr[i];
         base.s6_addr[i] = (h + add) & UINT8_MAX;
 
         /* using explicit carry for the 8-bit additions will catch
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: socket_util: Clean up conversion warnings in add_in6_addr

The patch itself is straight forward, but having a unit test for all the possible overflows is very welcome - "it will test itself, across all platforms". BB is all green, local test on Linux also passes.

Your patch has been applied to the master branch.

commit 84ef4848e7c7325759c67a1bfee231e13efe9f89

Author: Frank Lichtenheld
Date:   Sun Aug 31 17:12:52 2025 +0200
     socket_util: Clean up conversion warnings in add_in6_addr

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32725.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#5) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: socket_util: Clean up conversion warnings in add_in6_addr
......................................................................

socket_util: Clean up conversion warnings in add_in6_addr

Change-Id Id3b8719ee6b457ce2d85156b39e0cea771a97e74

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32725.html

---
M src/openvpn/socket_util.c

1 file changed, 3 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/1161/5

src/openvpn/socket_util.c +3 -5
index 13f8c32..9b7312d 100644
@@ -241,14 +241,12 @@
 struct in6_addr
 add_in6_addr(struct in6_addr base, uint32_t add)
 {
-    int i;
-
-    for (i = 15; i >= 0 && add > 0; i--)
+    for (int i = 15; i >= 0 && add > 0; i--)
     {
-        register int carry;
+        register uint32_t carry;
         register uint32_t h;
 
-        h = (unsigned char)base.s6_addr[i];
+        h = base.s6_addr[i];
         base.s6_addr[i] = (h + add) & UINT8_MAX;
 
         /* using explicit carry for the 8-bit additions will catch

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74
Gerrit-Change-Number: 1161
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email )

Change subject: socket_util: Clean up conversion warnings in add_in6_addr
......................................................................

socket_util: Clean up conversion warnings in add_in6_addr

Change-Id Id3b8719ee6b457ce2d85156b39e0cea771a97e74

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32725.html

---
M src/openvpn/socket_util.c

1 file changed, 3 insertions(+), 5 deletions(-)
src/openvpn/socket_util.c +3 -5
index 13f8c32..9b7312d 100644
@@ -241,14 +241,12 @@
 struct in6_addr
 add_in6_addr(struct in6_addr base, uint32_t add)
 {
-    int i;
-
-    for (i = 15; i >= 0 && add > 0; i--)
+    for (int i = 15; i >= 0 && add > 0; i--)
     {
-        register int carry;
+        register uint32_t carry;
         register uint32_t h;
 
-        h = (unsigned char)base.s6_addr[i];
+        h = base.s6_addr[i];
         base.s6_addr[i] = (h + add) & UINT8_MAX;
 
         /* using explicit carry for the 8-bit additions will catch

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1161?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74
Gerrit-Change-Number: 1161
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged